import axios from '@/utils/axios'

// 场景
export function scene(data) {
  return axios({
    url: '/digital-protal/pwSceneProduct/scene',
    method: 'get',
    params: data
  })
}

// 产品
export function product(data) {
  return axios({
    url: `/digital-protal/pwSceneProduct/product/${data}`,
    method: 'get'
  })
}

// 保存场景产品
export function saveSceneProd(data) {
  return axios({
    url: '/digital-protal/pwSceneProduct',
    method: 'post',
    data
  })
}

// 更新场景产品update
export function updateSceneProd(id, data) {
  return axios({
    url: `/digital-protal/pwSceneProduct/${id}`,
    method: 'put',
    data
  })
}

// 更新场景产品排序
export function sortSceneProd(data) {
  return axios({
    url: `/digital-protal/pwSceneProduct/order`,
    method: 'put',
    data
  })
}

// 更新模块排序
export function sortDataSubject(data) {
  return axios({
    url: `/digital-protal/pwDataSubject/order`,
    method: 'put',
    data
  })
}

// 删除场景产品
export function delSceneProd(id) {
  return axios({
    url: `/digital-protal/pwSceneProduct/${id}`,
    method: 'delete'
  })
}

// 获取数据主题
export function getDataSubject(productId, menuId) {
  return axios({
    url: `/digital-protal/pwDataSubject/${productId}/${menuId}`,
    method: 'get'
  })
}

// 编辑数据主题
export function updateDataSubject(data, id) {
  return axios({
    url: `/digital-protal/pwDataSubject/${id}`,
    method: 'put',
    data
  })
}

// 删除数据主题
export function delDataSubject(id) {
  return axios({
    url: `/digital-protal/pwDataSubject/${id}`,
    method: 'delete'
  })
}

// 保存数据主题
export function saveDataSubject(data) {
  return axios({
    url: `/digital-protal/pwDataSubject`,
    method: 'post',
    data
  })
}

// 产品介绍
export function getProductIntroduction(data) {
  return axios({
    url: `/digital-protal/pwProductIntroduction`,
    method: 'get',
    params: data
  })
}

// 获取字典
export function getDict(data) {
  return axios({
    url: `/digital-admin/sysdict`,
    method: 'get',
    params: data
  })
}

// 获取场景下开放数据
export function getOpenData(data) {
  return axios({
    url: `/digital-protal/pwDataDirectory`,
    method: 'get',
    params: data
  })
}

// 获取场景下开放数据
export function getAllInterFaceData(data) {
  return axios({
    url: `/digital-protal/pwProductIntroductionInterfaceRel/count`,
    method: 'get',
    params: data
  })
}
// 保存场景下开放数据
export function saveOpenData(data) {
  return axios({
    url: `/digital-protal/pwDataDirectory`,
    method: 'post',
    data
  })
}

// 更新场景下开放数据
export function updateOpenData(data, id) {
  return axios({
    url: `/digital-protal/pwDataDirectory/${id}`,
    method: 'put',
    data
  })
}

// 删除场景下开放数据
export function delOpenData(id) {
  return axios({
    url: `/digital-protal/pwDataDirectory/${id}`,
    method: 'delete',
  })
}

// 保存产品介绍
export function saveProdIntro(data) {
  return axios({
    url: `/digital-protal/pwProductIntroduction`,
    method: 'post',
    data
  })
}

// 删除产品介绍
export function delProdIntro(id) {
  return axios({
    url: `/digital-protal/pwProductIntroduction/${id}`,
    method: 'delete'
  })
}

// 编辑产品介绍/digital-protal/pwProductIntroduction/{id} put
export function updateProdIntro(data, id) {
  return axios({
    url: `/digital-protal/pwProductIntroduction/${id}`,
    method: 'put',
    data
  })
}

// 上传图片
export function uplodeImg(data) {
  return axios({
    url: `/digital-admin/sysfile/filesupload`,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    method: 'post',
    data
  })
}

// 文件预览
export function preview(data) {
  return axios({
    url: `/digital-admin/sysfile/preview`,
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    method: 'post',
    data
  })
}

// 删除图片
export function delImg(id) {
  return axios({
    url: `/digital-admin/sysfile/${id}`,
    method: 'delete',
  })
}

